import request from '@/axios'
import { SysApiMenuDetailVo, SysApiMenuEditQo, SysApiMenuListVo, SysApiMenuSearchQo } from './types'
import { BaseDeleteQo } from '@/base/api/BaseQo'
import { KeyLabelValueVo } from '@/base/api/KeyLabelValueVo'

export const sysApiMenuPageApi = (data: SysApiMenuSearchQo): Promise<IResponse<Array<SysApiMenuListVo>>> => {
  return request.post({ url: '/sysApiMenu/page.adw', data })
}

export const sysApiMenuDetailApi = (id: number): Promise<IResponse<SysApiMenuDetailVo>> => {
  const data = { id }
  return request.post({
    url: '/sysApiMenu/detail.adw',
    data
  })
}

export const sysApiMenuAddApi = (data: SysApiMenuEditQo): Promise<IResponse<number>> => {
  return request.post({ url: '/sysApiMenu/add.adw', data })
}

export const sysApiMenuUpdateApi = (data: SysApiMenuEditQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysApiMenu/update.adw', data })
}

export const sysApiMenuDeleteApi = (data: BaseDeleteQo): Promise<IResponse<void>> => {
  return request.post({ url: '/sysApiMenu/delete.adw', data })
}

// [[ OnflowGenerator Range (- selectFunctions -) Start ]]
export const selectSysApiMenuApiIdListApi = (
  data: SysApiMenuSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysApiMenu/selectApiIdList.adw', data })
}
export const selectSysApiMenuMenuIdListApi = (
  data: SysApiMenuSearchQo
): Promise<IResponse<Array<KeyLabelValueVo>>> => {
  return request.post({ url: '/sysApiMenu/selectMenuIdList.adw', data })
}
// [[ OnflowGenerator Range (- selectFunctions -) End ]]
